#include "Player.h"

std::vector<jfw::Player*> jfw::Player::PlayerList;

jfw::Player::Player()
{
    jfw::Player::PlayerList.push_back(this);
}

jfw::Player::~Player()
{
    //dtor
}

void jfw::Player::Update(float m_fDeltaTime)
{
    if (pEngine->pApp->GetInput().IsKeyDown(sf::Key::Left))  this->Move(-100 * m_fDeltaTime, 0);
    if (pEngine->pApp->GetInput().IsKeyDown(sf::Key::Right)) this->Move( 100 * m_fDeltaTime, 0);
    if (pEngine->pApp->GetInput().IsKeyDown(sf::Key::Up))    this->Move(0, -100 * m_fDeltaTime);
    if (pEngine->pApp->GetInput().IsKeyDown(sf::Key::Down))  this->Move(0,  100 * m_fDeltaTime);
}

void jfw::Player::DrawAll()
{
    for(unsigned int i=0; PlayerList.size()>i; ++i)
    {
        pEngine->pApp->Draw( *(PlayerList[i]) );
    }
}
